<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.wxtf.platform.plugins.user.*"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
	UserBean user = (UserBean)request.getSession().getAttribute("userBean");

	String _db = user.getDbType();
	String _style = user.getUserLay();
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<base href="<%=basePath%>" />
		<title>我的工作</title>
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta http-equiv="pragma" content="no-cache" />
		<meta http-equiv="cache-control" content="no-cache" />
		<meta http-equiv="expires" content="0" />
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		
		<link type="text/css" rel="stylesheet" href="ligerUI/skins/Aqua/css/ligerui-all.css" />
		<link type="text/css" rel="stylesheet" href="ligerUI/skins/<%=user.getUserCss()%>/css/ligerui-all.css" />
		<link type="text/css" rel="stylesheet" href="ligerUI/skins/ligerui-icons.css" />
		<link type="text/css" rel="stylesheet" href="resource/css/style.css" />
		
<style type="">
	body {
		color: #000000;
		margin: 0 auto;
		padding: 0 auto;
		margin-top: -50px;
		text-align: center;
		background-color: #CC6600;
		font-size: 14px;
		background-image: url(resource/images/bg01.jpg);
		background-color: #FFFFFF;
		background-repeat: repeat-x;
	}
</style>
		
		<script type="text/javascript" src="js/jquery/jquery-1.7.2.js"></script>
		<script type="text/javascript" src="ligerUI/js/core/base.js"></script>
		<script type="text/javascript" src="ligerUI/js/ligerui.min.js"></script>
		<script type="text/javascript" src="js/common.js"></script>
		
		<script type="text/javascript" src="js/jquery.marquee.js"></script>
		
<script type="text/javascript">
$(function(){
	_jsonObj.classname = "com.wxtf.platform.plugins.permissions.DesktopAction";
	_jsonObj.methodname = "listDesktop";
	
	var col = 5;
	var html = '';
	callserver(_jsonObj, function(data, satus){
		var arr = data[0].data;
		var row = parseInt(arr.length/col) + parseInt( arr.length%col==0?0:1);
		for(var i=0; i<row; i++){
			for(var j=0; j<col; j++){
				var k = i * col + j;
				if(k < arr.length){
					var str = "\'" + arr[k].id +"\',\'"+ arr[k].name +"\',\'"+ arr[k].action +"\',\'"+ arr[k].types +"\'";
					html += '<div class="middle_6_tu"><div>'
						  + '<img onclick="viewMenu('+str+');" alt="' + arr[k].name + '" src="' + arr[k].icon + '" width="64" height="64" style="cursor: pointer;" />'
						  + '</div><div class="wenzi">'
						  + '<a onclick="viewMenu('+str+');return false;" style="cursor: pointer;">' + arr[k].name + '</a></div></div>';
				} else {
					break;
				}
			}
		}
		document.getElementById('iconTable').innerHTML = html;

		if(parseInt(data[0].visit1) > 0){
			document.getElementById('img-visit1').src = 'resource/images/visit1-new.png';
		}
		if(parseInt(data[0].visit2) > 0){
			document.getElementById('img-visit2').src = 'resource/images/visit2-new.png';
		}
		if(parseInt(data[0].visit3) > 0){
			document.getElementById('img-visit3').src = 'resource/images/visit3-new.png';
		}
		
	},function(data, satus){
		
	});
	
	_jsonObj.methodname = "getNoticeAndAnnouncement";
	callserver(_jsonObj, function(data, satus){
		if(data && data.length > 0){
			//判断是否有公告需要显示
			if(data[0].announcements){
				var announcements = data[0].announcements;
				var msg = "";
				for(var i = 0 ; i < announcements.length ; i++){
					msg = msg + '<span style="margin:0px 50px;text-align:left;font-size:18px;line-height:25px;color:#c7001c">' + "公告" + announcements[i]["create_time"].substring(0,10) + " : " + announcements[i]["tma_content"] + '</span>';
				}
				var parent = $(window.parent.document.body);
				var marquee = parent.find("#announcementDiv").html('<marquee behavior="scroll" direction="left" scrollamount="2" width="' + parent.width() + '">' + msg + '</marquee>').show();
				marquee.find("marquee").marquee('pointer').mouseover(function () {
			        $(this).trigger('stop');
			    }).mouseout(function () {
			        $(this).trigger('start');
			    }).mousemove(function (event) {
			        if ($(this).data('drag') == true) {
			            this.scrollLeft = $(this).data('scrollX') + ($(this).data('x') - event.clientX);
			        }
			    }).mousedown(function (event) {
			        $(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft);
			    }).mouseup(function () {
			        $(this).data('drag', false);
			    });
			}
			//判断是否有通知需要显示
			if(data[0].notices){
				var notices = data[0].notices;
				var msg = "";
				for(var i = 0 ; i < notices.length ; i++){
					msg = msg + '<div style="padding:5px 0px;border-bottom:1px silver solid;text-align:left;">' + notices[i]["tmn_content"] + '</div>';
				}
				$.ligerDialog.tip({
					height:300,
					width:250,
					title: '【通知信息】',
					content: msg,
					isHidden:false
				});
			}
		}
	},function(data, satus){
	});
	
});

/*
 * 查看菜单
 */
function viewMenu(id,name,url,types){
	var tabid = '_tab_' + id;
	if(parent._tab.isTabItemExist(tabid)){//存在
		parent._tab.selectTabItem(tabid);
	} else {//不存在
		 if(types == 'iframe'){
			if(parent._tab.getTabItemCount() > parent._maxTab){
				var tabArray = parent._tab.getTabidList ('home', true);
				parent._tab.removeTabItem(tabArray[0]);
			}
  			parent._tab.addTabItem({ tabid: tabid, text: name, url: url });
        } else if(types == 'newPage'){
        	window.open(url, name);
        } else {
        	warningTip("菜单类型非法");
        }
	}
}

</script>
	</head>
	
	<body style="overflow:hidden;">
		<div id="iconTable" class="middle"></div>
		
		<div id="middle000" class="middle0">
    		<div class="middle1">
				<div id="Layer1">
					<div class="middle_1_tu">
						<div><img src="resource/images/add.png" onclick="viewMenu('7','添加新的应用','jsp/sys/desktop.jsp','iframe');" /></div>
						<a onclick="viewMenu('7','添加新的应用','jsp/sys/desktop.jsp','iframe');return false;" class="wenzicolor">添加新应用</a>
					</div>
					<div class="middle_1_tu">
						<div><img src="resource/images/skin.png" onclick="parent.showCssWin();" /></div>
						<a onclick="parent.showCssWin();return false;" class="wenzicolor">换肤中心</a>
					</div>
					<div class="middle_1_tu">
						<div><img src="resource/images/personal.png" onclick="viewMenu('80','个人设置','jsp/sys/personalSsettings.jsp','iframe');" /></div>
						<a onclick="viewMenu('80','个人设置','jsp/sys/personalSsettings.jsp','iframe');return false;" class="wenzicolor">个人设置</a>
					</div>
					<div class="middle_1_tu">
						<div><img src="resource/images/empQuery.png" onclick="viewMenu('dd50b3979cff498bb6001dd7f92af9cb','综合查询','jsp/app/dataQuery/employeeQuery.jsp','iframe');" /></div>
						<a onclick="viewMenu('dd50b3979cff498bb6001dd7f92af9cb','综合查询','jsp/app/dataQuery/employeeQuery.jsp','iframe');return false;" class="wenzicolor">综合查询</a>
					</div>
					<div class="middle_1_tu">
						<div><img id="img-visit1" src="resource/images/visit1.png" onclick="viewMenu('2569fd6173044154a1ba38d303611ffd','药具随访','jsp/app/contraceptives/tmaMedicineVistorManager.jsp','iframe');" /></div>
						<a onclick="viewMenu('2569fd6173044154a1ba38d303611ffd','药具随访','jsp/app/contraceptives/tmaMedicineVistorManager.jsp','iframe');return false;" class="wenzicolor">药具随访</a>
					</div>
					<div class="middle_1_tu">
						<div><img id="img-visit3" src="resource/images/visit3.png" onclick="viewMenu('bfc1ce7d8ec741e9811cfdf897bbdbef','手术随访','jsp/app/surgery/SurgreyRecord.jsp','iframe');" /></div>
						<a onclick="viewMenu('bfc1ce7d8ec741e9811cfdf897bbdbef','手术随访','jsp/app/surgery/SurgreyRecord.jsp','iframe');" class="wenzicolor">手术随访</a>
					</div>
					<div class="middle_1_tu">
						<div><img id="img-visit2" src="resource/images/visit2.png" onclick="viewMenu('c4175598e30843059e45e4df649e0459','重点服务对象','jsp/app/keySerObj/keyReg.jsp','iframe');" /></div>
						<a onclick="viewMenu('c4175598e30843059e45e4df649e0459','重点服务对象','jsp/app/keySerObj/keyReg.jsp','iframe');return false;" class="wenzicolor">重点对象</a>
					</div>
				</div> 
			</div>
		</div>
		<script type="text/javascript">
			//width: 60%;
			if('index.jsp' == '<%=_style%>'){
				$('#middle000').removeClass("middle0");
				$('#middle000').addClass("middle00");
			}
		</script>
	</body>
</html>
